package dao.majorunit;

import java.util.List;

import com.ibatis.sqlmap.client.SqlMapClient;

import util.paramvo.MemberPageListParamVO;
import util.paramvo.SearchParamVO;
import vo.MajorunitVO;

public class MajorunitDAOImpl implements MajorunitDAO{
	private SqlMapClient sqlMapClient;

	public void setSqlMapClient(SqlMapClient sqlMapClient) {
		this.sqlMapClient = sqlMapClient;
	}

	@Override
	public List<MajorunitVO> getSearchedUnitByWord(SearchParamVO search) throws Exception {
		return sqlMapClient.queryForList("majorunit.getSearchedUnitByWord", search);
	}

	@Override
	public List<MajorunitVO> getSearchedUnitBySubline(SearchParamVO search) throws Exception {
		return sqlMapClient.queryForList("majorunit.getSearchedUnitBySubline", search);
	}

	@Override
	public List<MajorunitVO> getSearchedUnitByRegion(SearchParamVO search) throws Exception {
		return sqlMapClient.queryForList("majorunit.getSearchedUnitByRegion", search);
	}

	@Override
	public MajorunitVO getTopUnit(String column) throws Exception {
		return (MajorunitVO) sqlMapClient.queryForObject("majorunit.getTopUnit", column);
	}

	@Override
	public MajorunitVO getRegionTopUnit(int region_no) throws Exception {
		return (MajorunitVO) sqlMapClient.queryForObject("majorunit.getRegionTopUnit", region_no);
	}

	@Override
	public MajorunitVO getLineTopUnit(int subline_no) throws Exception {
		return (MajorunitVO) sqlMapClient.queryForObject("majorunit.getLineTopUnit", subline_no);
	}

	@Override
	public MajorunitVO getOneUnit(int majorunit_no) throws Exception {
		return (MajorunitVO) sqlMapClient.queryForObject("majorunit.getOneUnit", majorunit_no);
	}

	@Override
	public List<MajorunitVO> getInterestedUnit(MemberPageListParamVO param) throws Exception {
		return sqlMapClient.queryForList("majorunit.getInterestedUnit", param);
	}

	@Override
	public int countSearchedUnitByWord(SearchParamVO search) throws Exception {
		return (Integer) sqlMapClient.queryForObject("majorunit.countSearchedUnitByWord", search);
	}

	@Override
	public int countSearchedUnitBySubline(SearchParamVO search) throws Exception {
		return (Integer) sqlMapClient.queryForObject("majorunit.countSearchedUnitBySubline", search);
	}

	@Override
	public int countSearchedUnitByRegion(SearchParamVO search) throws Exception {
		return (Integer) sqlMapClient.queryForObject("majorunit.countSearchedUnitByRegion", search);
	}

	@Override
	public List<MajorunitVO> getSearchedUnitByLine(SearchParamVO search) throws Exception {
		return sqlMapClient.queryForList("majorunit.getSearchedUnitByLine", search);
	}

	@Override
	public int countSearchedUnitByLine(SearchParamVO search) throws Exception {
		return (Integer) sqlMapClient.queryForObject("majorunit.countSearchedUnitByLine", search);
	}

	@Override
	public List<MajorunitVO> getTop3Unit(String column) throws Exception {
		return sqlMapClient.queryForList("majorunit.getTop3Unit", column);
	}
}
